//
//  ClubJoinConditionVC.m
//  SelfDrivingTravelling-IOS
//
//  Created by Teplot_01 on 16/9/3.
//  Copyright © 2016年 Teplot_01. All rights reserved.
//

#import "ClubJoinConditionVC.h"

@interface ClubJoinConditionVC ()

@end

@implementation ClubJoinConditionVC
{
    UIButton *_noConditionBtn;
    UIButton *_joinActityBtn;
    UIButton *_otherBtn;
    
    UITextField *_textField;
    UILabel *_label;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"加入条件";
    self.view.backgroundColor = White_Color;
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"保存" style:UIBarButtonItemStylePlain target:self action:@selector(saveAction)];
    [self initView];
}
- (void)initView{
    _noConditionBtn = [[UIButton alloc]initWithFrame:CGRectMake(20, 80, 100, 30)];
    [_noConditionBtn setImage:[UIImage imageNamed:@"selected.png"] forState:UIControlStateNormal];
    [_noConditionBtn setTitle:@"无条件加入" forState:UIControlStateNormal];
    _noConditionBtn.titleLabel.font = [UIFont systemFontOfSize:15];
    [_noConditionBtn setTitleColor:Theme_Color forState:UIControlStateNormal];
    [_noConditionBtn addTarget:self action:@selector(noConditionBtnAction) forControlEvents:UIControlEventTouchUpInside];
    _noConditionBtn.imageEdgeInsets = UIEdgeInsetsMake(0, -20, 0, 0);
    [self.view addSubview:_noConditionBtn];
    
    _joinActityBtn = [[UIButton alloc]initWithFrame:CGRectMake(KScreenWidth/2 - 40, 80, 100, 30)];
    [_joinActityBtn setImage:[UIImage imageNamed:@"unselected.png"] forState:UIControlStateNormal];
    [_joinActityBtn setTitle:@"参与活动" forState:UIControlStateNormal];
    _joinActityBtn.titleLabel.font = [UIFont systemFontOfSize:15];
    [_joinActityBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [_joinActityBtn addTarget:self action:@selector(joinActityBtnAction) forControlEvents:UIControlEventTouchUpInside];
    _joinActityBtn.imageEdgeInsets = UIEdgeInsetsMake(0, -20, 0, 0);
    [self.view addSubview:_joinActityBtn];
    
    _otherBtn = [[UIButton alloc]initWithFrame:CGRectMake(KScreenWidth - 70, 80, 50, 30)];
    [_otherBtn setImage:[UIImage imageNamed:@"unselected.png"] forState:UIControlStateNormal];
    [_otherBtn setTitle:@"其他" forState:UIControlStateNormal];
    _otherBtn.titleLabel.font = [UIFont systemFontOfSize:15];
    [_otherBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [_otherBtn addTarget:self action:@selector(otherBtnAction) forControlEvents:UIControlEventTouchUpInside];
    _otherBtn.imageEdgeInsets = UIEdgeInsetsMake(0, -20, 0, 0);
    [self.view addSubview:_otherBtn];
}
//
- (void)noConditionBtnAction{
    [_noConditionBtn setImage:[UIImage imageNamed:@"selected.png"] forState:UIControlStateNormal];
    [_noConditionBtn setTitleColor:Theme_Color forState:UIControlStateNormal];
    [_joinActityBtn setImage:[UIImage imageNamed:@"unselected.png"] forState:UIControlStateNormal];
    [_joinActityBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [_otherBtn setImage:[UIImage imageNamed:@"unselected.png"] forState:UIControlStateNormal];
    [_otherBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    
    [_textField removeFromSuperview];
    [_label removeFromSuperview];
}
- (void)joinActityBtnAction{
    [_noConditionBtn setImage:[UIImage imageNamed:@"unselected.png"] forState:UIControlStateNormal];
    [_noConditionBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [_joinActityBtn setImage:[UIImage imageNamed:@"selected.png"] forState:UIControlStateNormal];
    [_joinActityBtn setTitleColor:Theme_Color forState:UIControlStateNormal];
    [_otherBtn setImage:[UIImage imageNamed:@"unselected.png"] forState:UIControlStateNormal];
    [_otherBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    
    //
    [_textField removeFromSuperview];
    [_label removeFromSuperview];
    _textField = [[UITextField alloc]initWithFrame:CGRectMake(20, 130, KScreenWidth - 40, 40)];
    _textField.placeholder = @"请输入参与活动的次数";
    _textField.layer.cornerRadius = 3;
    _textField.layer.borderWidth = 1;
    _textField.layer.borderColor = Gray_Color.CGColor;
    [self.view addSubview:_textField];
    _label = [[UILabel alloc]initWithFrame:CGRectMake(20, 170, 200, 30)];
    _label.text = @"*仅参与本俱乐部活动才为有效次数";
    _label.font = [UIFont systemFontOfSize:12];
    _label.textColor = Orange_Color;
    [self.view addSubview:_label];
}
- (void)otherBtnAction{
    [_noConditionBtn setImage:[UIImage imageNamed:@"unselected.png"] forState:UIControlStateNormal];
    [_noConditionBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [_joinActityBtn setImage:[UIImage imageNamed:@"unselected.png"] forState:UIControlStateNormal];
    [_joinActityBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [_otherBtn setImage:[UIImage imageNamed:@"selected.png"] forState:UIControlStateNormal];
    [_otherBtn setTitleColor:Theme_Color forState:UIControlStateNormal];
    
    [_textField removeFromSuperview];
    [_label removeFromSuperview];
    
    _textField.placeholder = @"请输入其他要求";
    [self.view addSubview:_textField];
}

- (void)saveAction{
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
